
/*
 * swf载入完成事件
 */
function cdcSwfuploadLoaded()
{
	this.setButtonDisabled(false);
	
}
/*
 * 打开选择文件对话框事件
 */
function cdcFileDialogStart()
{
	this.setButtonDisabled(true);
}

/*
 * 文件被 添加到序列后事件
 */
function cdcFileQueued(file)
{
	
	this.startUpload();
}
/*
 * 将文件添加到序列发生错误时事件
 */
function cdcFileQueueError(file, errorCode, message)
{	
	
	$.dialog({type: "warn", content: "上传错误请重试", modal: true, autoCloseTime: 3000});
	this.setButtonDisabled(false);
}

/*
 * 选择完文件，点击确定按钮后事件
 */
function cdcFileDialogComplete(numFilesSelected, numFilesQueued)
{	try {
	this.setButtonDisabled(false);
	this.startUpload();
	} catch (ex) {
		this.debug(ex);
	}
}

/*
 * 开始上传事件
 */
function cdcUploadStart(file)
{
	try {
		
	} catch (ex) {
		this.debug(ex);
	}
}

/*
 * 文件上传过程事件
 */
function cdcUploadProgress(file, bytesLoaded, bytesTotal)
{
	try {
		
		
	} catch (ex) {
		
		this.debug(ex);
	}
}
/*
 * 文件上传错误事件
 */
function cdcUploadError(file, errorCode, message)
{
	try {

		if (this.getStats().files_queued > 0) {
			this.cancelUpload();
		}
		var movieName = this.getSetting('movieName');
		$('#container-' + movieName + ' tr.' + file.id + ' td.fstatus').html('错误' + errorCode + message);
	} catch (ex) {
		this.debug(ex);
	}
}

/*
 * 文件上传完成事件
 */
function cdcUploadComplete(file)
{
	try {
		if (this.getStats().files_queued > 0) {
			this.startUpload();
		} else {
			this.setButtonDisabled(false);
			var movieName = this.getSetting('movieName');
			$('#btn-start-' + movieName).val('上传完成');
		}
	} catch (ex) {
		this.debug(ex);
	}
	
}


function hideThumbnail()
{
	$('#thumbnail-layer').hide();
	return false;
}

function insertToContent()
{
	var tthis = $(this);
	var type = tthis.attr('class');
	var linkUlr = $(this).attr('title');
	if (type == 'thumbnail') {
		var html = '<img src="' + linkUlr + '" border="0" alt="' + linkUlr + '" />';
	} else {
		var html = '<a href="' + linkUlr + '" target="_blank"/>链接文字</a>';
	}
	
	CKEDITOR.instances.content.insertHtml(html);
}


